#include "../include/lidar.h"

// 构造函数定义
Lidar::Lidar(const std::string &model, int channels, float range, int powerConsumption)
    : model(model), channels(channels), range(range), powerConsumption(powerConsumption) {}

Lidar::Lidar(): Lidar("RS-Helios-16p", 16, 100, 8) {}

// 将属性写入文件的方法
void Lidar::writeToFile(std::ofstream &file) {
    if (file.is_open()) {
        file << "激光雷达：" << std::endl;
        file << " Model: " << model << std::endl;
        file << " channels: " << channels << std::endl;
        file << " Range: " << range << std::endl;
        file << " powerConsumption: " << powerConsumption <<std::endl;
    }
}

// 打印属性的方法
void Lidar::print() const {
    std::cout << "激光雷达：" << std::endl;
    std::cout << " Model: " << model << std::endl;
    std::cout << " channels: " << channels << std::endl;
    std::cout << " Range: " << range << std::endl;
    std::cout << " powerConsumption: " << powerConsumption << std::endl;
}